class Solution {
public:
    int findMin(vector<int>& nums) {
/*
3 4 5 1 2    让每个数尝试跟结尾比较 nums[i] <= nums[n-1]
0 0 0 1 1


4 5 6 7 0 1 2 
0 0 0 0 1 1 1
*/
        int left = 0, right = nums.size() - 1;
        while (left < right) {
            int mid = (left + right) / 2;
            if (nums[mid] <= nums[right]) {  // 条件满足（true，即1）
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return nums[right];
    }
};